#ifndef __WIZ_BNF_CLOSURE_HPP__SHANHAOBO_19800429__
#define __WIZ_BNF_CLOSURE_HPP__SHANHAOBO_19800429__

#include "./Actor/WizBNFActor.hpp"

namespace Wiz
{
    namespace BNF
    {
        namespace Closure
        {
            /// Forward declaration
            namespace Frame
            {
                template <typename ClosureT>
                class Type;
            } /// end of namespace Frame

            namespace Context
            {
                namespace Init
                {
                    template <typename ClosureT>
                    class Type : public ::Wiz::BNF::Context::Base::Type
                    {
                        typedef typename ClosureT::tTuple      tTuple;
                        typedef typename ClosureT::tClosure    tClosure;

                    public:

                        Type(ClosureT const& Clos) : m_Frame(Clos.Subject(), ::Wiz::BNF::Actor::ConvertActors<tTuple>(Clos.m_Init))
                        {}

                        ~Type()
                        {}

                        template <typename ParserT, typename ScannerT>
                        ::Wiz::Void::Type PreParse(ParserT const&, ScannerT const&)
                        {}

                        template <typename ResultT, typename ParserT, typename ScannerT>
                        ResultT& PostParse(ResultT& Rslt, ParserT const&, ScannerT const&)
                        {
                            Rslt.Value(m_Frame[::Wiz::Tuple::Index::Type<0>()]);
                            return Rslt;
                        }
                    private:

                        ::Wiz::BNF::Closure::Frame::Type<tClosure> m_Frame;
                    };

                } /// end of namespace Init

                namespace Linker
                {
                    template<typename ContextT>
                    struct Type : public ContextT
                    {
                        template <typename ParserT>
                        Type(ParserT const& Prsr) : ContextT(Prsr)
                        {}

                        template <typename ParserT, typename ScannerT>
                        ::Wiz::Void::Type PreParse(ParserT const& Prsr, ScannerT const& Scan)
                        {
                            ContextT::PreParse(Prsr, Scan);
                        }

                        template <typename ResultT, typename ParserT, typename ScannerT>
                        ResultT& PostParse(ResultT& Hit, ParserT const& Prsr, ScannerT const& Scan)
                        {
                            return ContextT::PostParse(Hit, Prsr, Scan);
                        }
                    };
                } /// end of namespace Linker
            } /// end of namespace Context

            namespace Init
            {
                template <typename ParserT, typename ActorTupleT>
                struct Type
                    : public ::Wiz::BNF::Parser::Unary::Type<ParserT, ::Wiz::BNF::Parser::Type<Type<ParserT, ActorTupleT>>>
                {
                    typedef Type<ParserT, ActorTupleT>                                                  tThis;
                    typedef ::Wiz::BNF::Parser::Unary::Type<ParserT, ::Wiz::BNF::Parser::Type<tThis>>   tSuper;
                    typedef typename ParserT::tInnerClosure                                             tClosure;
                    typedef typename ParserT::tTuple                                                    tTuple;
                    typedef typename ::Wiz::Tuple::Element::Type<0, tTuple>::tType                      tAttribute;

                    template <typename ScannerT>
                    struct Result
                    {
                        typedef typename ::Wiz::BNF::Match::Result<ScannerT, tAttribute>::tType              tType;
                    };

                    Type(ParserT const& Prsr, ActorTupleT const& _Init)
                        : tSuper(Prsr), m_Init(_Init)
                    {}

                    template <typename ScannerT>
                    typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType
                    ParseMain(ScannerT const& Scan) const
                    {
                        return this->Subject().ParseMain(Scan);
                    }

                    template <typename ScannerT>
                    typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType
                    Parse(ScannerT const& Scan) const
                    {
                        typedef ::Wiz::BNF::Closure::Context::Init::Type<tThis>                 tInitContext;
                        typedef ::Wiz::BNF::Scanner::Linker::Type<ScannerT>                     tScannerLinker;
                        typedef ::Wiz::BNF::Closure::Context::Linker::Type<tInitContext>        tContextLinker;
                        typedef typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType     tResult;

                        tScannerLinker ScanWrap(Scan);
                        tContextLinker ContextWrap(*this); 
                        ContextWrap.PreParse(*this, ScanWrap);
                        tResult Hit = ParseMain(Scan);
                        return ContextWrap.PostParse(Hit, *this, ScanWrap);
                    }

                    ActorTupleT m_Init;
                };
            } /// end of namespace Init

            namespace Frame
            {
                namespace Holder
                {
                    template <typename FrameT>
                    struct Type
                    {
                        typedef FrameT                  tFrame;
                        typedef tFrame*                 tFramePtr;

                        Type() : m_TLSFrame()
                        {}

                        tFramePtr& Get()
                        {
                            if (::Wiz::NotValidPtr(m_TLSFrame.GetData()))
                            {
                                m_TLSFrame.Reset(new tFramePtr(WIZ_NULLPTR));
                            }
                            return this->FramePtrRef();
                        }

                        ::Wiz::Void::Type Set(tFramePtr FrmPtr)
                        {
                            this->FramePtrRef() = FrmPtr;
                        }

                    private:
                        WIZ_INLINE tFramePtr& FramePtrRef()
                        {
                            return *m_TLSFrame;
                        }

                        ::Wiz::Thread::TLS::Type<tFramePtr> m_TLSFrame;
                    };
                } /// end of namespace Holder

                template <typename ClosureT>
                class Type : public ClosureT::tTuple, ::Wiz::Noncopyable::Type
                {
                    typedef typename ClosureT::tTuple       tSuper;
                public:
                    Type(ClosureT const& Clos) : tSuper(), m_Save(Clos.m_FrameHolder.Get()), m_FrameHolder(Clos.m_FrameHolder)
                    {
                        Clos.m_FrameHolder.Set(this);
                    }

                    template <typename TupleT>
                    Type(ClosureT const& Clos, TupleT const& Init) : tSuper(Init), m_Save(Clos.m_FrameHolder.Get()), m_FrameHolder(Clos.m_FrameHolder)
                    {
                        Clos.m_FrameHolder.Set(this); 
                    }

                    ~Type()
                    {
                        m_FrameHolder.Set(m_Save);
                    }

                private:
                    Type*                                               m_Save;
                    ::Wiz::BNF::Closure::Frame::Holder::Type<Type>&     m_FrameHolder;
                };
            } /// end of namespace Frame

            namespace Member
            {
                template <int N, typename ClosureT>
                class Type
                {
                public:
                    typedef typename ClosureT::tTuple                   tTuple;

                    Type() : m_FrameHolder(ClosureT::ClosureFrameHolderRef())
                    {
                    }

                    template <typename TupleT>
                    struct Result
                    {
                        typedef typename ::Wiz::Tuple::Element::Type<N, typename ClosureT::tTuple>::tReference  tType;
                    };

                    template <typename TupleT>
                    typename ::Wiz::Tuple::Element::Type<N, typename ClosureT::tTuple>::tReference
                    Evaluate(TupleT const&) const
                    {
                        WIZ_ASSERT(::Wiz::IsValidPtr(m_FrameHolder.Get()));
                        return (*m_FrameHolder.Get())[::Wiz::Tuple::Index::Type<N>()];
                    }
                private:
                    ::Wiz::BNF::Closure::Frame::Holder::Type<typename ClosureT::tClosureFrame>& m_FrameHolder;
                };
            } /// end of namespace Member

            namespace Context
            {
                template <typename ClosureT>
                class Type : public ::Wiz::BNF::Context::Base::Type
                {
                public:
                    typedef Type                                                                        tThis;
                    typedef ClosureT                                                                    tSuper;
                    typedef typename ::Wiz::Tuple::Element::Type<0, typename ClosureT::tTuple>::tType   tAttribute;
                    typedef ::Wiz::BNF::Closure::Context::Linker::Type<tThis>                           tContextLinker;

                    Type(ClosureT const& Clos) : m_Frame(Clos)
                    {}

                    ~Type()
                    {}

                    template <typename ParserT, typename ScannerT>
                    ::Wiz::Void::Type PreParse(ParserT const&, ScannerT const&)
                    {}

                    template <typename ResultT, typename ParserT, typename ScannerT>
                    ResultT& PostParse(ResultT& Rslt, ParserT const&, ScannerT const&)
                    {
                        Rslt.Value(m_Frame[::Wiz::Tuple::Index::Type<0>()]);
                        return Rslt;
                    }
                private:
                    ::Wiz::BNF::Closure::Frame::Type<typename ClosureT::tInnerClosure> m_Frame;
                };
            } /// end of namespace Context

            namespace Inner
            {

                ///////////////////////////////////////////////////////////////////////////////
                //
                //  closure class
                //
                ///////////////////////////////////////////////////////////////////////////////
                template
                <
                    typename T0 = ::Wiz::Null::Type,
                    typename T1 = ::Wiz::Null::Type,
                    typename T2 = ::Wiz::Null::Type,
                    typename T3 = ::Wiz::Null::Type,
                    typename T4 = ::Wiz::Null::Type,
                    typename T5 = ::Wiz::Null::Type,
                    typename T6 = ::Wiz::Null::Type,
                    typename T7 = ::Wiz::Null::Type,
                    typename T8 = ::Wiz::Null::Type,
                    typename T9 = ::Wiz::Null::Type
                >
                class Type
                {
                public:
                    typedef ::Wiz::Tuple::Type<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>  tTuple;
                    typedef Type                                                        tThis;
                    typedef ::Wiz::BNF::Closure::Frame::Type<tThis>                     tClosureFrame;
                    typedef ::Wiz::BNF::Closure::Frame::Holder::Type<tClosureFrame>     tFrameHolder;
                    typedef tFrameHolder*                                               tFrameHolderPtr;
                    typedef tFrameHolder&                                               tFrameHolderRef;
                    
                    Type()
                    {
                        ClosureFrameHolderRef(&m_FrameHolder);
                    }

                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<0, tThis>> tMember0;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<1, tThis>> tMember1;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<2, tThis>> tMember2;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<3, tThis>> tMember3;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<4, tThis>> tMember4;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<5, tThis>> tMember5;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<6, tThis>> tMember6;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<7, tThis>> tMember7;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<8, tThis>> tMember8;
                    typedef ::Wiz::BNF::Actor::Type<::Wiz::BNF::Closure::Member::Type<9, tThis>> tMember9;


                    static ::Wiz::Thread::TLS::Type<tFrameHolderPtr>& TLSFrameInstance()
                    {
                        static ::Wiz::Thread::TLS::Type<tFrameHolderPtr> SInstance;
                        return SInstance;
                    }

                    static ::Wiz::Void::Type TLSFrameInstanceInit()
                    {
                        TLSFrameInstance();
                    }

                    static tFrameHolderRef ClosureFrameHolderRef(tFrameHolderPtr HolderPtr = WIZ_NULLPTR)
                    {
                        static ::Wiz::CallOnce::Flag::Type BeenHere = ::Wiz::CallOnce::Flag::Init;
                        ::Wiz::CallOnce::Do(BeenHere, TLSFrameInstanceInit);

                        ::Wiz::Thread::TLS::Type<tFrameHolderPtr>& TLSFrame = TLSFrameInstance();
                        if (::Wiz::NotValidPtr(TLSFrame.GetData()))
                        {
                            TLSFrame.Reset(new tFrameHolderPtr(WIZ_NULLPTR));
                        }

                        tFrameHolderPtr& FrmHolder = *TLSFrame;

                        if (::Wiz::IsValidPtr(HolderPtr))
                        {
                            FrmHolder = HolderPtr;
                        }

                        return *FrmHolder;
                    }

                    mutable tFrameHolder m_FrameHolder;
                };
            } /// end of namespace Inner

            namespace Container
            {
                template <typename ActorT>
                struct Begin
                {
                    typedef Begin<ActorT> tThis;

                    template <typename TupleT>
                    struct Result
                    {
                        typedef typename ::Wiz::BNF::Actor::Result<ActorT, TupleT>::tPlain::tIterator tType;
                    };

                    Begin(ActorT Act) : m_Actor(Act)
                    {}

                    template <typename TupleT>
                    typename ::Wiz::BNF::Actor::Result<tThis, TupleT>::tType
                    Evaluate(TupleT const&) const
                    {
                        return m_Actor().Begin();
                    }

                    ActorT m_Actor;
                };

                template <typename ActorT>
                struct End
                {
                    typedef End<ActorT> tThis;

                    template <typename TupleT>
                    struct Result
                    {
                        typedef typename ::Wiz::BNF::Actor::Result<ActorT, TupleT>::tPlain::tIterator tType;
                    };

                    End(ActorT Act) : m_Actor(Act)
                    {}

                    template <typename TupleT>
                    typename ::Wiz::BNF::Actor::Result<tThis, TupleT>::tType
                    Evaluate(TupleT const&) const
                    {
                        return m_Actor().end(); 
                    }

                    ActorT m_Actor;
                };

            } /// end of namespace Container

            ///////////////////////////////////////////////////////////////////////////
            //
            //  closure class
            //
            ///////////////////////////////////////////////////////////////////////////
            template
                <
                typename DerivedT,
                typename T0 = ::Wiz::Null::Type,
                typename T1 = ::Wiz::Null::Type,
                typename T2 = ::Wiz::Null::Type,
                typename T3 = ::Wiz::Null::Type,
                typename T4 = ::Wiz::Null::Type,
                typename T5 = ::Wiz::Null::Type,
                typename T6 = ::Wiz::Null::Type,
                typename T7 = ::Wiz::Null::Type,
                typename T8 = ::Wiz::Null::Type,
                typename T9 = ::Wiz::Null::Type
                >
            struct Type : public ::Wiz::BNF::Closure::Inner::Type<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>
            {
                typedef ::Wiz::BNF::Closure::Inner::Type<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>    tInnerClosure;
                typedef ::Wiz::BNF::Closure::Context::Type<DerivedT>                                tContext;

                template <typename DerivedT2>
                struct AUX
                {
                    DerivedT2& AUXDerived()
                    {
                        return *static_cast<DerivedT2*>(this);
                    }

                    DerivedT2 const& AUXDerived() const
                    {
                        return *static_cast<DerivedT2 const*>(this);
                    }

                    template <typename T0>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<typename ::Wiz::BNF::Actor::As<T0>::tType>>
                    operator()(T0 const &t0) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef ::Wiz::Tuple::Type<tA0>                         tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0))
                            );
                    }

                    template <typename T0, typename T1>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<typename ::Wiz::BNF::Actor::As<T0>::tType, typename ::Wiz::BNF::Actor::As<T1>::tType>>
                    operator()(T0 const &t0, T1 const &t1) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef ::Wiz::Tuple::Type<tA0, tA1>                    tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1))
                            );
                    }

                    template <typename T0, typename T1, typename T2>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<typename ::Wiz::BNF::Actor::As<T0>::tType, typename ::Wiz::BNF::Actor::As<T1>::tType, typename ::Wiz::BNF::Actor::As<T2>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2>               tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2))
                            );
                    }

                    template <typename T0, typename T1, typename T2, typename T3>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<
                        typename ::Wiz::BNF::Actor::As<T0>::tType,
                        typename ::Wiz::BNF::Actor::As<T1>::tType,
                        typename ::Wiz::BNF::Actor::As<T2>::tType,
                        typename ::Wiz::BNF::Actor::As<T3>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef typename ::Wiz::BNF::Actor::As<T3>::tType       tA3;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2, tA3>          tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2)),
                            tActorTupe(::Wiz::BNF::Actor::As<T3>::Convert(t3))
                            );
                    }

                    template <typename T0, typename T1, typename T2, typename T3, typename T4>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<
                        typename ::Wiz::BNF::Actor::As<T0>::tType,
                        typename ::Wiz::BNF::Actor::As<T1>::tType,
                        typename ::Wiz::BNF::Actor::As<T2>::tType,
                        typename ::Wiz::BNF::Actor::As<T3>::tType,
                        typename ::Wiz::BNF::Actor::As<T4>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef typename ::Wiz::BNF::Actor::As<T3>::tType       tA3;
                        typedef typename ::Wiz::BNF::Actor::As<T4>::tType       tA4;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2, tA3, tA4>     tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2)),
                            tActorTupe(::Wiz::BNF::Actor::As<T3>::Convert(t3)),
                            tActorTupe(::Wiz::BNF::Actor::As<T4>::Convert(t4))
                            );
                    }

                    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<
                        typename ::Wiz::BNF::Actor::As<T0>::tType,
                        typename ::Wiz::BNF::Actor::As<T1>::tType,
                        typename ::Wiz::BNF::Actor::As<T2>::tType,
                        typename ::Wiz::BNF::Actor::As<T3>::tType,
                        typename ::Wiz::BNF::Actor::As<T4>::tType,
                        typename ::Wiz::BNF::Actor::As<T5>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef typename ::Wiz::BNF::Actor::As<T3>::tType       tA3;
                        typedef typename ::Wiz::BNF::Actor::As<T4>::tType       tA4;
                        typedef typename ::Wiz::BNF::Actor::As<T5>::tType       tA5;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2, tA3, tA4, tA5>     tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2)),
                            tActorTupe(::Wiz::BNF::Actor::As<T3>::Convert(t3)),
                            tActorTupe(::Wiz::BNF::Actor::As<T4>::Convert(t4)),
                            tActorTupe(::Wiz::BNF::Actor::As<T5>::Convert(t5))
                            );
                    }

                    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<
                        typename ::Wiz::BNF::Actor::As<T0>::tType,
                        typename ::Wiz::BNF::Actor::As<T1>::tType,
                        typename ::Wiz::BNF::Actor::As<T2>::tType,
                        typename ::Wiz::BNF::Actor::As<T3>::tType,
                        typename ::Wiz::BNF::Actor::As<T4>::tType,
                        typename ::Wiz::BNF::Actor::As<T5>::tType,
                        typename ::Wiz::BNF::Actor::As<T6>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef typename ::Wiz::BNF::Actor::As<T3>::tType       tA3;
                        typedef typename ::Wiz::BNF::Actor::As<T4>::tType       tA4;
                        typedef typename ::Wiz::BNF::Actor::As<T5>::tType       tA5;
                        typedef typename ::Wiz::BNF::Actor::As<T6>::tType       tA6;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2, tA3, tA4, tA5, tA6>     tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2)),
                            tActorTupe(::Wiz::BNF::Actor::As<T3>::Convert(t3)),
                            tActorTupe(::Wiz::BNF::Actor::As<T4>::Convert(t4)),
                            tActorTupe(::Wiz::BNF::Actor::As<T5>::Convert(t5)),
                            tActorTupe(::Wiz::BNF::Actor::As<T6>::Convert(t6))
                            );
                    }

                    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<
                        typename ::Wiz::BNF::Actor::As<T0>::tType,
                        typename ::Wiz::BNF::Actor::As<T1>::tType,
                        typename ::Wiz::BNF::Actor::As<T2>::tType,
                        typename ::Wiz::BNF::Actor::As<T3>::tType,
                        typename ::Wiz::BNF::Actor::As<T4>::tType,
                        typename ::Wiz::BNF::Actor::As<T5>::tType,
                        typename ::Wiz::BNF::Actor::As<T6>::tType,
                        typename ::Wiz::BNF::Actor::As<T7>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef typename ::Wiz::BNF::Actor::As<T3>::tType       tA3;
                        typedef typename ::Wiz::BNF::Actor::As<T4>::tType       tA4;
                        typedef typename ::Wiz::BNF::Actor::As<T5>::tType       tA5;
                        typedef typename ::Wiz::BNF::Actor::As<T6>::tType       tA6;
                        typedef typename ::Wiz::BNF::Actor::As<T7>::tType       tA7;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2, tA3, tA4, tA5, tA6, tA7>     tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2)),
                            tActorTupe(::Wiz::BNF::Actor::As<T3>::Convert(t3)),
                            tActorTupe(::Wiz::BNF::Actor::As<T4>::Convert(t4)),
                            tActorTupe(::Wiz::BNF::Actor::As<T5>::Convert(t5)),
                            tActorTupe(::Wiz::BNF::Actor::As<T6>::Convert(t6)),
                            tActorTupe(::Wiz::BNF::Actor::As<T7>::Convert(t7))
                            );
                    }

                    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<
                        typename ::Wiz::BNF::Actor::As<T0>::tType,
                        typename ::Wiz::BNF::Actor::As<T1>::tType,
                        typename ::Wiz::BNF::Actor::As<T2>::tType,
                        typename ::Wiz::BNF::Actor::As<T3>::tType,
                        typename ::Wiz::BNF::Actor::As<T4>::tType,
                        typename ::Wiz::BNF::Actor::As<T5>::tType,
                        typename ::Wiz::BNF::Actor::As<T6>::tType,
                        typename ::Wiz::BNF::Actor::As<T7>::tType,
                        typename ::Wiz::BNF::Actor::As<T8>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef typename ::Wiz::BNF::Actor::As<T3>::tType       tA3;
                        typedef typename ::Wiz::BNF::Actor::As<T4>::tType       tA4;
                        typedef typename ::Wiz::BNF::Actor::As<T5>::tType       tA5;
                        typedef typename ::Wiz::BNF::Actor::As<T6>::tType       tA6;
                        typedef typename ::Wiz::BNF::Actor::As<T7>::tType       tA7;
                        typedef typename ::Wiz::BNF::Actor::As<T8>::tType       tA8;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2, tA3, tA4, tA5, tA6, tA7, tA8>     tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2)),
                            tActorTupe(::Wiz::BNF::Actor::As<T3>::Convert(t3)),
                            tActorTupe(::Wiz::BNF::Actor::As<T4>::Convert(t4)),
                            tActorTupe(::Wiz::BNF::Actor::As<T5>::Convert(t5)),
                            tActorTupe(::Wiz::BNF::Actor::As<T6>::Convert(t6)),
                            tActorTupe(::Wiz::BNF::Actor::As<T7>::Convert(t7)),
                            tActorTupe(::Wiz::BNF::Actor::As<T8>::Convert(t8))
                            );
                    }

                    template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
                    ::Wiz::BNF::Closure::Init::Type<DerivedT2, ::Wiz::Tuple::Type<
                        typename ::Wiz::BNF::Actor::As<T0>::tType,
                        typename ::Wiz::BNF::Actor::As<T1>::tType,
                        typename ::Wiz::BNF::Actor::As<T2>::tType,
                        typename ::Wiz::BNF::Actor::As<T3>::tType,
                        typename ::Wiz::BNF::Actor::As<T4>::tType,
                        typename ::Wiz::BNF::Actor::As<T5>::tType,
                        typename ::Wiz::BNF::Actor::As<T6>::tType,
                        typename ::Wiz::BNF::Actor::As<T7>::tType,
                        typename ::Wiz::BNF::Actor::As<T8>::tType,
                        typename ::Wiz::BNF::Actor::As<T9>::tType>>
                        operator()(T0 const &t0, T1 const &t1, T2 const &t2, T3 const &t3, T4 const &t4, T5 const &t5, T6 const &t6, T7 const &t7, T8 const &t8, T9 const &t9) const
                    {
                        typedef typename ::Wiz::BNF::Actor::As<T0>::tType       tA0;
                        typedef typename ::Wiz::BNF::Actor::As<T1>::tType       tA1;
                        typedef typename ::Wiz::BNF::Actor::As<T2>::tType       tA2;
                        typedef typename ::Wiz::BNF::Actor::As<T3>::tType       tA3;
                        typedef typename ::Wiz::BNF::Actor::As<T4>::tType       tA4;
                        typedef typename ::Wiz::BNF::Actor::As<T5>::tType       tA5;
                        typedef typename ::Wiz::BNF::Actor::As<T6>::tType       tA6;
                        typedef typename ::Wiz::BNF::Actor::As<T7>::tType       tA7;
                        typedef typename ::Wiz::BNF::Actor::As<T8>::tType       tA8;
                        typedef typename ::Wiz::BNF::Actor::As<T9>::tType       tA9;
                        typedef ::Wiz::Tuple::Type<tA0, tA1, tA2, tA3, tA4, tA5, tA6, tA7, tA8, tA9>     tActorTupe;

                        return ::Wiz::BNF::Closure::Init::Type<DerivedT2, tActorTupe>
                            (
                            AUXDerived(),
                            tActorTupe(::Wiz::BNF::Actor::As<T0>::Convert(t0)),
                            tActorTupe(::Wiz::BNF::Actor::As<T1>::Convert(t1)),
                            tActorTupe(::Wiz::BNF::Actor::As<T2>::Convert(t2)),
                            tActorTupe(::Wiz::BNF::Actor::As<T3>::Convert(t3)),
                            tActorTupe(::Wiz::BNF::Actor::As<T4>::Convert(t4)),
                            tActorTupe(::Wiz::BNF::Actor::As<T5>::Convert(t5)),
                            tActorTupe(::Wiz::BNF::Actor::As<T6>::Convert(t6)),
                            tActorTupe(::Wiz::BNF::Actor::As<T7>::Convert(t7)),
                            tActorTupe(::Wiz::BNF::Actor::As<T8>::Convert(t8)),
                            tActorTupe(::Wiz::BNF::Actor::As<T9>::Convert(t9))
                            );
                    }
                };

                ~Type() {}
            };
        } /// end of namespace Closure
    } /// end of namespace BNF
} /// end of namespace Wiz

#endif /*__WIZ_BNF_CLOSURE_HPP__SHANHAOBO_19800429__*/
